package NetWork;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2022-09-01
 * Time: 17:45
 */
public class TcPDictServer extends TcpEchoServer{
    private Map<String,String> dict=new HashMap<>();
    public TcPDictServer(int port) throws IOException {
        super(port);
        dict.put("cat","小猫");
    }
    @Override
    public String process(String req) {
        return dict.getOrDefault(req,"卢世杰");
    }

    public static void main(String[] args) throws IOException {
        TcPDictServer tcPDictServer=new TcPDictServer(8002);
        tcPDictServer.start();
    }

}
